@use '@scss/common.scss' as *;

$curve: cubic-bezier(0.165, 0.84, 0.44, 1);

.desktopNav {
  position: relative;
  width: 100%;
  height: var(--header-height);

  &:before,
  &:after {
    content: '';
    pointer-events: none;
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -5;
    transition: all var(--trans-default) $curve;
  }

  @include mobile-header-break {
    display: none;
    visibility: hidden;
  }
}

.background {
  height: var(--header-height);
  top: var(--header-height);
  position: absolute;
  z-index: -1;
  width: 100%;
  margin: 0 calc(var(--gutter-h) * -1);
  transition: all calc(var(--trans-default) * 2) $curve;

  &:before,
  &:after {
    content: '';
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    transition: all calc(var(--trans-default) * 2) $curve;
  }

  &:before {
    background: var(--theme-bg);
    opacity: 0.9;
  }

  &:after {
    backdrop-filter: blur(5px);
    opacity: 0;
  }
}

.active {
  &:before,
  &:after {
    transition: all var(--trans-default) $curve;
  }

  &:before {
    background: var(--theme-elevation-800);
    opacity: 0.15;
    pointer-events: all;
  }

  .dropdown {
    z-index: 1;
  }

  .background {
    &:after {
      opacity: 1;
    }
  }
}

.grid {
  height: 100%;

  :local(a) {
    text-decoration: none;
  }
}

.content {
  display: flex;
  position: relative;
  width: 100%;
}

.authNav {
  display: flex;
  align-items: center;

  & > *:not(:last-child) {
    margin-right: 1rem;
  }
}

.container {
  position: relative;
}

.logo {
  display: flex;
  height: 100%;
  align-items: center;

  svg {
    height: 1.25rem;
    width: auto;
  }
}

.tabs {
  position: relative;
  padding: 0;
  flex-grow: 1;
  display: flex;
  flex-direction: row;
  gap: 1.5rem;
}

.tab {
  @include btnReset;
  cursor: pointer;
  height: 100%;
  text-decoration: none;
}

.directLink {
  height: 100%;
  text-decoration: none;
  display: flex;
  align-items: center;

  &:hover,
  &:focus {
    opacity: 1;
    text-decoration: none;
  }
}

.tabArrow,
.linkArrow {
  margin-left: 0.5rem;
  width: 0.5rem;
  height: 0.5rem;
}

.underline {
  position: absolute;
  bottom: 0;
  transition: all var(--trans-default) $curve;
}

.underlineFill {
  height: 2px;
  background-color: var(--theme-elevation-800);
}

.dropdownWrap {
  position: relative;
}

.description {
  @include large-body;
  & {
    max-width: 300px;
  }
}

.dropdown {
  position: fixed;
  left: 0;
  width: 100%;
  pointer-events: none;
  padding: 2.5rem var(--gutter-h) 0 var(--gutter-h);
  transition: opacity var(--trans-default) $curve;
}

.dropdownItem {
  position: relative;
}

.dropdownItem,
.description {
  text-wrap: wrap;
  margin-right: 2rem;
  padding-bottom: 2.5rem;
  transition: opacity var(--trans-default) $curve;
  opacity: 0;

  &:before {
    transition: all var(--trans-default) $curve;
    content: '';
    display: block;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    background-color: var(--theme-elevation-1000);
    height: 2px;
    opacity: 1;
  }

  &:last-child {
    padding-right: 0;
  }

  & svg {
    transition: all var(--trans-default) $curve;
  }

  @for $i from 1 through 5 {
    &:nth-child(#{$i}n) {
      transition-delay: #{((6 - $i) * 0.025)}s;
    }
  }
}

.activeTab {
  pointer-events: all;

  .description,
  .dropdownItem {
    opacity: 1;
    transform: translateY(0);
    transition: all var(--trans-default) $curve;

    @for $i from 1 through 5 {
      &:nth-child(#{$i}n) {
        transition-delay: #{($i * 0.075)}s;
      }
    }
  }
}

.showUnderline {
  &:before {
    transition: all var(--trans-default) $curve;
    width: 100%;
  }
  & svg {
    transition: all var(--trans-default) $curve;
    transform: translate3d(10px, -10px, 0);
  }
}

.defaultLink,
.defaultLinkDescription {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  justify-content: space-between;
}

.defaultLink {
  flex: 1;
  height: 100%;
  transition: opacity var(--trans-default) $curve;

  &:focus {
    text-decoration: none;
  }
}

.defaultLinkLabel {
  @include h4;
  & {
    margin: 0;
    flex-grow: 1;
  }
}

.defaultLinkDescription {
  min-height: 5rem;
  @include small;
}

.tab {
  font-size: var(--font-body-size);
}

.secondaryNavItems {
  @include small;
}

.linkList,
.featuredLink {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.listLabel {
  @include h6;
  & {
    margin: 0;
    text-transform: uppercase;
  }
}

.link {
  @include body;
  & {
    font-weight: 500;
    transition: all var(--trans-default) $curve;
    text-decoration: none;
  }

  &:focus {
    text-decoration: none;
  }

  &:hover {
    transition: all var(--trans-default) $curve;
    opacity: 0.8;
  }
}

.featuredLinks,
.descriptionLink {
  @include body;
  & {
    display: flex;
    align-items: center;
    flex-direction: row;
    transition: all var(--trans-default) $curve;
    letter-spacing: 0;
  }

  &:hover {
    transition: all var(--trans-default) $curve;
    opacity: 0.8;
  }
}

.descriptionLink {
  width: 100%;
}

.featuredLinkWrap {
  display: flex;
  flex-direction: row;
  gap: 2rem;
}

.descriptionLinks {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 2rem 0;
}

.secondaryNavItems {
  height: 100%;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  white-space: nowrap;
  gap: 1.25rem;
  opacity: 0;
  visibility: hidden;
  transition: all var(--trans-default) $curve;

  & > a {
    &:hover {
      opacity: 0.8;
    }
  }
}

.show {
  opacity: 1;
  visibility: visible;
}

.payload {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.button {
  display: flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  color: var(--theme-elevation-0);
  background: var(--theme-elevation-1000);
  border: 1px solid var(--theme-elevation-1000);
  border-radius: 4px;
}

.icons {
  display: flex;
  align-items: center;
  @include small;

  > * {
    margin-right: 0.75rem;

    &:last-child {
      margin-right: 0;
    }
  }
}

.github {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  svg {
    width: 1.25rem;
  }

  &:hover {
    opacity: 0.8;
  }
}

[data-theme='dark'] {
  .background {
    &:before {
      opacity: 0.9;
    }
  }

  .active {
    &:before {
      background: var(--theme-elevation-50);
      opacity: 0.85;
    }
  }
}
